<template>
  <van-swipe :autoplay="3000">
    <van-swipe-item v-for="(image, index) in imgs" :key="index">
      <img v-lazy="image" />
    </van-swipe-item>
  </van-swipe>
</template>
<script>
import Vue from "vue";
import { Lazyload } from "vant";
import axios from "axios";

Vue.use(Lazyload);

export default {
  name: "banner1",
  data() {
    return {
      imgs: [],
    };
  },
  created() {
    axios({
      url: "http://localhost:3000/imgs",
    }).then((res) => {
      //把后端的数据赋给了imgs
      this.imgs = res.data;
      console.log(this.imgs);
    });
  },
};
</script>
<style>
img{
  width: 100%;
}
</style>